// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose: declaration of CDOM3Document.
//   $Id$



// DOM3Core.h: Definition of the CDocument class
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DOM3CORE_H__A41B3CD7_F4E3_42B2_9772_19D3AD986C57__INCLUDED_)
#define AFX_DOM3CORE_H__A41B3CD7_F4E3_42B2_9772_19D3AD986C57__INCLUDED_

#if _MSC_VER > 1000
#pragma once

#endif // _MSC_VER > 1000

#include "resource.h"       // main symbols
#include "msxml6.h"
#include <map>
/////////////////////////////////////////////////////////////////////////////
// CDocument

typedef BSTR CDOMString;
typedef IXMLDOMNode CNode;
typedef IXMLDOMNodeList CNodeList;
typedef IXMLDOMElement CElement;
class CDOM3Document;
class CDOM3Node
{
public:
//	CDOM3Node cloneNode(bool bDeep);
	CDOM3Node()
	{
	};
	virtual ~CDOM3Node()
	{
	};
	CDOMString get_baseURI();
	CDOM3Document * get_ownerDocument();
private:
	//CNode * m_pNode; the only class to inherit at the moment is CDOM3Document
	//	that already points to its node.
//	CDOM3Document * m_pOwnerDocument;
protected:
//	IXMLDOMNode * m_pMSXMLNode;
};


class CDOM3Document :
	public CDOM3Node
{
public:
	CDOM3Document();
	CDOM3Document(IXMLDOMDocument *pDoc);
	virtual ~CDOM3Document();

// [TODO]
// This is temporarily public, until we add more methods.
//private:
	CComPtr<IXMLDOMDocument> m_pXMLParser;

	//This should be a data member, but while direct access is 
	//	given to the enclosed MSXML object, we cannot change it 
	//	when we load a new document.
	CDOMString get_documentURI();
	static void DestroyFactory();
private:
	HRESULT CreateDOMDocument();
	static CComPtr<IClassFactory> sm_pDOMDocumentFactory;
	static HANDLE sm_hDOMDocumentFactoryMutex;
};

class CXSLTemplate
{
public:
	CXSLTemplate();
	virtual ~CXSLTemplate();

// [TODO]
// This is temporarily public, until we add more methods.
//private:
	IXSLTemplate* m_pXSLTemplate;
};


#include "mapBSTRToBSTR.h"
/*
 * [TODO]
 * The following is not defined in DOM 3 Core, but may exist somewhere in all the DOM stuff
 */

class CXMLRequest
{
public:
	HRESULT postNode(CNode* pNode, BSTR sURI);
	HRESULT sendText(BSTR sText, BSTR sURI, CComBSTRMap &HeadersList, BSTR sType=NULL, const BSTR sMethod=L"post", const BSTR sUsername = L"", const BSTR sPassword = L"");
	HRESULT sendText(VARIANT * pvtData, BSTR sURI, CComBSTRMap &HeadersList, BSTR sType=NULL, const BSTR sMethod=L"post", const BSTR sUsername = L"", const BSTR sPassword = L"");
	HRESULT sendTextAsync(VARIANT * pvtData, BSTR sURI, CComBSTRMap &HeadersList, BSTR sType,const BSTR sMethod, const BSTR sUsername, const BSTR sPassword, IDispatch* pOnChange);
	CXMLRequest();
	virtual ~CXMLRequest();

// [TODO]
// This is temporarily public, until we add more methods.
//private:
	IXMLHTTPRequest* m_pXMLRequest;
	HRESULT AddHeader(BSTR sName, BSTR sValue);
};

#endif // !defined(AFX_DOM3CORE_H__A41B3CD7_F4E3_42B2_9772_19D3AD986C57__INCLUDED_)
